#include <myheader.h>

/* Usage:  */
int main(int argc, char *argv[]){                                  
    int fd=open("1.txt",O_RDWR);
    int fd2=open("2.txt",O_RDWR);

    char buf[100]={0};
    
    while(1){
    //先从2.txt里面读取数据
     while(1){  ssize_t sret=read(fd2,buf,sizeof(buf));
   if(sret>0){
    printf("%s");
    memset(buf,0,sizeof(buf));
   break;
   }
    
    }
    
    //往1.txt里面写数据
    read(0,buf,sizeof(buf));
    write(fd,buf,strlen(buf));
    memset(buf,0,sizeof(buf));
    }
    return 0;
}

